
import { Routes, Route } from 'react-router-dom'

import Layout from './pages/Layout'
import Login from './pages/Login'

import './App.css'
import { AuthRoute } from '@/components/AuthRoute'

import Home from './pages/Home'
import Article from './pages/Article'
import Publish from './pages/Publish'
import { history, HistoryRouter } from '@/utils'


function App() {
  return(
  <HistoryRouter history={history}>
      <div className='App'>
        <Routes>
          {/* 需要鉴权的路由 */}
          <Route path='/' element={<AuthRoute> <Layout /> </AuthRoute>}> 
            {/* 二级路由 */}
            <Route index element={<Home/>}></Route>
            <Route path='/article' element={<Article/>}></Route>
            <Route path='/publish' element={<Publish />}></Route>
          </Route>
          
          {/* 无需鉴权的路由 */}
          <Route path='/login' element={<Login/>} />
        </Routes>
    </div>
    
  </HistoryRouter >
  )
}

export default App